import Vue from 'vue'
import Vuex from 'vuex'
import *as actions from './actions'
import *as getters from './getters'
import state from './state'
import mutations from './mutations'

//通过mutaions修改state的时候,会在控制台打印日志显示修改记录
import createLogger from 'vuex/dist/logger' 

Vue.use(Vuex)


//debug 检测对state的修改是否是通过mutation去修改的 直接修改会报错
const debug = process.env.NODE_ENV !== 'production' 

export default new Vuex.Store({
	actions,
	getters,
	state,
	mutations,
	strict: debug, //开启严格模式,不建议线上使用,
	plugins:debug ? [createLogger()] : [] //接收一个数组
})